﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace devtm.Editor.TypeSelector.Types
{

    public class ContainerError : IEnumerable<ContextTypeError>
    {


        internal ContainerError()
        {

        }

        private List<ContextTypeError> _lst = new List<ContextTypeError>();


        internal void Add(ContextTypeError item)
        {
            _lst.Add(item);
        }

        internal void Clear()
        {
            _lst.Clear();
        }

        public int Count
        {
            get
            {
                return _lst.Count();
            }
        }

        public IEnumerator<ContextTypeError> GetEnumerator()
        {
            return _lst.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _lst.GetEnumerator();
        }

        public override string ToString()
        {

            StringBuilder s = new StringBuilder();

            foreach (ContextTypeError i in _lst)
                s.AppendLine(i.Description);
            
            return s.ToString();
        }

    }

}
